#!/bin/sh
#
# /etc/rc.d/rc.gsad
#
# Start/stop/restart the Greenbone Security Assistant Daemon.
#
# To make Greenbone SA start automatically at boot, make this
# file executable:  chmod 755 /etc/rc.d/rc.gsad
# and add to rc.local:
# if [ -x /etc/rc.d/rc.gsad ]; then
#   . /etc/rc.d/rc.gsad start
# fi
#

GSAD_PATH=/usr/sbin
GSAD_BIN=gsad
GSAD_OPTIONS="-p 9392 --timeout=60 --gnutls-priorities=SECURE128:-VERS-SSL3.0"
GSAD_CMD="$GSAD_PATH/$GSAD_BIN $GSAD_OPTIONS"

gsad_start() {
  echo Starting Greenbone Security Assistant: $GSAD_CMD
  $GSAD_CMD
}

gsad_stop() {
  echo "Stopping Greenbone Security Assistant"
  /bin/killall $GSAD_BIN
}

gsad_restart() {
  gsad_stop
  gsad_start
}

case "$1" in
'start')
  gsad_start
  ;;
'stop')
  gsad_stop
  ;;
'restart')
  gsad_restart
  ;;
*)
  echo "usage $0 start|stop|restart"
esac
